// import { responseItemTranformer } from '@/modules/graph/utils/item'
import { graphDataTransformer } from '@/modules/graph/utils/data'
import { linebreakFormat } from '@/modules/smart/utils/function'

export default {
  prefix: '/app',
  configs: {
    initGraph(projectId) {
      return {
        path: `/qaInitial/${projectId}`,
        method: 'GET'
      }
    },
    askQuestion(question) {
      return {
        path: '/question',
        method: 'POST',
        data: question,
        mapper(data) {
          return {
            graph: graphDataTransformer(data.graph),
            text: linebreakFormat(data.text)
          }
        }
      }
    },
    askRule(question) {
      return {
        // question.projectId
        path: `/zzgzTL/${0}/${question.text}/`,
        method: 'GET',
        data: question,
        mapper(data) {
          return {
            graph: graphDataTransformer(data),
            // text: linebreakFormat(data.text)
          }
        }
      }
    },
    askRuleTable(question) {
      return {
        // question.projectId
        path: `/zzgzTLTable/${0}/${question.text}/`,
        method: 'GET',
        data: question,
      }
    },
    askActionTable(data) {
      return {
        path: `/zzmbXWTLTable`,
        method: 'POST',
        data: data,
      }
    },
    askAction(question) {
      return {
        // question.projectId
        path: `/zzmbXWTL/${0}/${question.nodeId}/${question.behaviorParams}`,
        method: 'GET',
        data: question,
        mapper(data) {
          return {
            graph: graphDataTransformer(data),
            // text: linebreakFormat(data.text)
          }
        }
      }
    },
    verifyInitiate(projectId) {
      return {
        path: `/verifyInitial/${projectId}`,
        method: 'GET'
      }
    },
    entityQuery(question) {
      console.log(question)
      return {
        path: '/entityQuery',
        method: 'POST',
        data: question,
        mapper(data) {
          return graphDataTransformer(data)
        }
      }
    },
    entityQueryGlobal(question) {
      return {
        path: '/entityQueryGlobal',
        method: 'POST',
        data: question,
        mapper(data) {
          
          return graphDataTransformer(data)
        }
      }
    },
    entityQueryGlobalMultiName(question) {
      return {
        path: '/entityQueryGlobalMultiName',
        method: 'POST',
        data: question,
        mapper(data) {
          
          return graphDataTransformer(data)
        }
      }
    },


    relationQuery(question) {
      return {
        path: '/relQuery',
        method: 'POST',
        data: question,
        mapper(data) {
          return graphDataTransformer(data)
        }
      }
    },
    validPath(question) {
      return {
        path: `/validPath/${0}/${question.sourceName}/${question.targetName}`,
        method: 'GET',
        data: question,
        mapper(data) {
          return graphDataTransformer(data)
        }
      }
    },
    linkPrediction(question) {
      return {
        path: `/linkprediction/${0}/${question.sourceName}/${question.targetName}`,
        method: 'GET',
        data: question,
        // mapper(data) {
        //   return graphDataTransformer(data)
        // }
      }
    },
    getRelations(projectId) {
      return {
        path: `/relationNames/${projectId}`,
        method: 'GET'
      }
    },
    getHotQuestions(projectId) {
      return {
        path: `/hotQuestion/${projectId}`,
        method: 'GET'
      }
    },
    
    getCentrality(projectId) {
      return {
        path: `/centrality/${projectId}`,
        method: 'GET'
      }
    }
  }
}
